layui.use('form', function(){
});

var vm = new Vue({
    el: '#app',
    data: {
        userName : "",
        userPassword :"",
        userTrueName: "",
        userPhone: "",
        userEmail:""
    },
    methods: {
        add() {
            var tmp = {
                'userName': vm.userName,
                'userPassword': vm.userPassword,
                'userTrueName': vm.userTrueName,
                "userPhone": vm.userPhone,
                "userEmail": vm.userEmail
            };
            var data = JSON.stringify(tmp)
            $.ajax({
                type: "post",
                url: "/authUser/admin/3",
                headers: { 'Content-Type': 'application/json;charset=utf-8' },
                dataType: 'json',
                async: true,
                data: data,
                success: function (result) {
                    console.log(result)
                    if (result.code == 500) {
                        layer.msg(result.msg)
                    } else {
                        alert("成功")
                        window.location.href="userManger.html"
                    }
                },
                error: function (xhr, ajaxOptions, thrownError) {
                    if(xhr.status==403) {
                        alert("无权限")
                        location.reload([true])
                    }
                }
            });
        },
        back(){
            window.location.href="userManger.html"
        }
    }
})